﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using NLBS.Framework;
using System.Web;
using NLBS.Resources;
using NLBS.Data;
using NLBS.Web;
namespace NLBS
{
   public static class BasePage
    {
       public static Dictionary<string, string> lang(this Page obj)
       {
          return Language.Instance().getLanguage();
       }

       public static void CheckAdmin(this Page obj)
       {

           if (!HttpContext.Current.Request.IsAuthenticated && BlogInfo.Instance().CurrentUser.Group.GroupID != 1)
           {
               throw new Exception("没有操作的权限");
           }
       }
    }

   public static class BaseUserControls
   {
       public static Dictionary<string, string> lang(this UserControl control)
       {
           return control.Page.lang();
       }

       public static void CheckAdmin(this Page obj)
       {

           if (!HttpContext.Current.Request.IsAuthenticated && BlogInfo.Instance().CurrentUser.Group.GroupID != 1)
           {
               throw new Exception("没有操作的权限");
           }
       }

       public static blog_Setting GetBlogInfo(this UserControl control)
       {
               return blog_Setting.Instance();
       }

       public static Guid? GetBlogIDQuery(this UserControl control)
       {
          return control.Request.GetQueryGuid("BlogID");
       }

       public static string GetBlogNameQuery(this UserControl control)
       {
           return control.Request.QueryString["BlogName"];
       }
   }
}
